/*Shifting Positions*/
/*By Katie Angell and Elias Chavarria-Mora*/

clear
drop _all

import delimited "C:\1 Elías Importante\1 Serious\Academia\University of Pittsburgh\1st Year\Comparative Legislatures/RestauracionNacionalManifestoI&II.csv"

preserve

/*save the file*/
save RestauracionNacionalManifestoI&II.dta

/*load data*/
use "C:\Elias\1 Serious\Academia\University of Pittsburgh\1st Year\Comparative Legislatures\ShiftingPositions\RestauracionNacionalManifestoI&II.dta"


/*see the salience per theme*/
gen FreedomDemocracy = ld1 + ld2 +ld3
recode FreedomDemocracy (2=1)
tab FreedomDemocracy gen4

gen PoliticalSystem = sp1 + sp2 +sp3 + sp4
recode PoliticalSystem (2=1)
tab PoliticalSystem gen4

gen Economy = eco1 + eco2 + eco3 + eco4 + eco5 + eco6 + eco7 + eco8 + eco9 + eco10  
recode Economy (2=1)(3=1)
tab Economy gen4

gen Wellbeing = bcd1 + bcd2 + bcd3 + bcd4 + bcd5 + bcd6 + bcd7 
recode Wellbeing (2=1)(3=1)
tab Wellbeing gen4

gen SocialFabric = ts1 + ts2 + ts3 + ts4 + ts5 + ts6 + ts7 + ts8
recode SocialFabric (2=1)
tab SocialFabric gen4

gen SocialClass = cs1 + cs2 + cs3 + cs4 +cs5
recode SocialClass (2=1)
tab SocialClass gen4

gen ForeignPolicy = pe1 + pe2
recode ForeignPolicy (2=1)
tab ForeignPolicy gen4


graph bar FreedomDemocracy, over (gen4) ytitle ("Freedom and Democracy")
graph save FreedomDemocracy
graph bar PoliticalSystem, over (gen4) ytitle ("Poitical System")
graph save PoliticalSystem
graph bar Economy, over (gen4) ytitle ("Economy")
graph save Economy
graph bar Wellbeing, over (gen4) ytitle ("Well-being")
graph save Wellbeing
graph bar SocialFabric, over (gen4) ytitle ("Social Fabric")
graph save SocialFabric
graph bar SocialClass, over (gen4) ytitle ("Social Class")
graph save SocialClass
graph bar ForeignPolicy, over (gen4) ytitle ("Foreign Policy")
graph save ForeignPolicy

gr combine FreedomDemocracy.gph PoliticalSystem.gph Economy.gph Wellbeing.gph SocialFabric.gph SocialClass.gph ForeignPolicy.gph, ycommon
graph save SalienceTogether
graph export mygraph.tif, width (10000)

/*graph export mygraph.tif, width(4000)*/

/*gen4 indicates whether it is the first or second manifesto*/
/*Economic and social spatial position*/

gen EconSc = (eco1 + eco2 + eco5 + eco10 + bcd5 - (eco3 + eco4 + eco6 + eco8 + bcd5) + 5)/10 
gen SocSc = (ld1 + ts2 + ts4 + ts7 + pe2 - (ld3 + ts1 + ts3 + ts5 + ts8) + 5)/10


/*View average of score per manifesto*/
tab gen4, sum (EconSc)
tab gen4, sum (SocSc)

/*salience for economic and social*/
gen EconSa = (eco1 + eco2 + eco5 + eco10 + bcd5 + eco3 + eco4 + eco6 + eco8 + bcd5)
recode EconSa (2=1)
tab EconSa gen4

gen SocSa = (ld1 + ts2 + ts4 + ts7 + pe2 + ld3 + ts1 + ts3 + ts5 + ts8)
recode SocSa (2=1) (3=1)
tab SocSa gen4

/*T-test, significance in indicated y the lowest number at the center, we want a <0.05*/

ttest EconSa, by (gen4)
ttest SocSa, by (gen4)

ttest EconSc, by(gen4)
ttest SocSc, by(gen4) 


clear
drop _all

/*Extras*/
/*Salience per topic*/
graph bar freedomdemocracy politicalsystem economy wellbeing socialfabric socialclas foreignpolicy, by gen4 


